package com.server.runtime;

import gnu.cajo.invoke.Remote;

import java.rmi.RemoteException;
import java.util.Date;

import combat.protocol.data.DoublePoint;
import combat.protocol.data.PhysicalObject;
import combat.protocol.interfaces.TrackInt;
import combat.protocol.interfaces.UserInt;
import combat.protocol.types.PhysicalObjectType;
import combat.protocol.types.StandingType;

public class trackImpl extends PhysicalObject implements TrackInt {
	private static final long serialVersionUID = 1L;

	private int trackID = 0;
	private UserInt user = null;
	private StandingType standing = StandingType.UNKNOWN;
	private Date timestamp = null;

	public trackImpl() {}

	public trackImpl(String name, DoublePoint position, int altitude, double direction, double speed, int trackID, UserInt user, StandingType standing, Date timestamp) {
		super(PhysicalObjectType.TRACK, name, position, altitude, direction, speed);
		this.trackID = trackID;
		this.user = user;
		this.standing = standing;
		this.timestamp = timestamp;
	}

	public int getTrackID() {
		return trackID;
	}
	
	public void setTrackID(int trackID) {
		this.trackID = trackID;
	}

	public UserInt getUser() {
		return user;
	}
	
	public void setUser(UserInt user) {
		this.user = user;
	}

	public StandingType getStanding() {
		return standing;
	}
	
	public void setStanding(StandingType standing) {
		this.standing = standing;
	}

	public Date getTimestamp() {
		return timestamp;
	}

	public void setTimestamp(Date timestamp) {
		this.timestamp = timestamp;
	}

	public Remote getUser_Remote() {
		try {
			return new Remote(getUser());
		} catch(RemoteException e) {
			System.out.println("ERROR: getUser_Remote function failed");
		}
		return null;
	}

}